; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-attributes
; RUN: opt < %s -passes=function-attrs -S | FileCheck %s

@x = global i32 0

declare i32 @e() readnone

define i32 @f() {
; CHECK: Function Attrs: nofree nosync memory(none)
; CHECK-LABEL: @f(
; CHECK-NEXT:    [[TMP:%.*]] = call i32 @e()
; CHECK-NEXT:    ret i32 [[TMP]]
;
  %tmp = call i32 @e()
  ret i32 %tmp
}

define i32 @g() readonly {
; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
; CHECK-LABEL: @g(
; CHECK-NEXT:    ret i32 0
;
  ret i32 0
}

define i32 @h() readnone {
; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
; CHECK-LABEL: @h(
; CHECK-NEXT:    [[TMP:%.*]] = load i32, ptr @x, align 4
; CHECK-NEXT:    ret i32 [[TMP]]
;
  %tmp = load i32, ptr @x
  ret i32 %tmp
}
